<?php

class Soul_Template_Html_Grid_Cell_Link extends Soul_Template_Html_Grid_Cell_Base {

    private $_url = '';
    private $_target = '';

    public function __construct(){
        parent::__construct();
    }

    public function getTarget(){
        return $this->_target;
    }

    public function setTarget($value){
        $this->_target = $value;
        return $this;
    }

    public function getUrl(){
    	return $this->_url;
    }
    public function setUrl($value){
    	$this->_url = $value;
    	return $this;
    }

    public function formatLinkUrl(){
        return Soul_Util_String::format($this->getUrl(), $this->getGrid()->getCurrentRow());
    }

    public function renderChildren() {
        $target = $this->getTarget()? ' target="'.$this->getTarget().'"': '';
        return '<a'.$target.' href="'.$this->formatLinkUrl().'"><span>'.$this->getFormatText().'</span></a>';
    }
}